package data;

import anaydis.sort.data.DataSetGenerator;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;


public class IntegerDataSetGenerator implements DataSetGenerator {


    @NotNull
    public List createAscending(int i) {
        List<Integer> list = new ArrayList<Integer>();
        for (int j = 0; j <= i; j++) {
            list.add(j);
        }
        return list;
    }

    @NotNull
    public List createDescending(int i) {
        List<Integer> list = new ArrayList<Integer>();
        for (int j = i; j >= 0; j--) {
            list.add(j);
        }
        return list;
    }

    @NotNull
    public List createRandom(int i) {
        List<Integer> list = new ArrayList<Integer>();
        for (int j = 0; j <= i; j++) {
            list.add((int) (Math.random() * i));
        }
        return list;
    }

    @NotNull
    public Comparator getComparator() {
        return new Comparator<Integer>() {
            public int compare(Integer i, Integer j) {
                return i.compareTo(j);
            }
        };
    }
}
